home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
A-Monthly Disks
/
(c)aae.d64
/
blackjack.3
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
8KB
|
410 lines
1 GOTO910
5 REM * BLACKJACK FROM THE PUBLIC DOMAIN WITH CHAGES MADE FOR THE C64 BY
6 REM * KEN JIRELE AND FRED LAYBERGER, OMAHA NEBRASKA
10 REM **GENERAL INPUT ROUTINE **
15 :
30 :
35 REM +++ INPUT SECTION +++
40 POKEUO,0:UR$="":UI$=""
42 IFUL=0THENUL=80
45 POKEUC,0
50 GETUI$:IFUI$=""THEN50
55 IFUI$=CHR$(13)ANDLEN(UR$)>=1THENPOKEUC,1:PRINT" [157]";:GOTO120
60 IFUI$=CHR$(20)THEN105
62 IF LEN(UR$)=>ULTHEN50
65 GOSUB120:REM CHECK FOR VALID CHARACTER
70 UR$=UR$+UI$
75 PRINTUI$;
80 GOTO50
102 REM ++ CHECK DELETE ++
105 IFLEN(UR$)<1THEN50
110 UR$=LEFT$(UR$,LEN(UR$)-1)
115 PRINT"[157] [157][157]";:GOTO50
120 REM ++ CHECK FOR VALID CHARACTERS ++
125 IFLEN(US$)=0THEN150
130 FORUS=1TOLEN(US$)
135 IFUI$=MID$(US$,US,1)THENRETURN
140 NEXT
145 UI$="":RETURN
150 REM ** STANDARD INPUT **
152 IFASC(UI$)=46THENRETURN
155 IFUI$=CHR$(32)THENRETURN
160 IFASC(UI$)<48ORASC(UI$)>57THEN170
165 RETURN
170 IFASC(UI$)<65ORASC(UI$)>90THEN180
175 RETURN
180 IFASC(UI$)<193ORASC(UI$)>218THENUI$="":RETURN
185 IFPEEK(UT)=UL%THENUI$=CHR$(ASC(UI$)-128):RETURN
187 RETURN
190 UI$="":RETURN
216 GOTO300
217 UZ=0:US$=UJ$:UG$=UK$:UP=UJ:UL=UK:IFPEEK(50003)=0THENPOKE53281,6:POKE53280,14
220 PRINT"[147]";:POKEUT,UV%:FORUQ=UBTO(U2%*256+U1%+U3%-3)
225 POKEUQ,UQ%(UQ-UB):NEXT
230 POKEU1,U1%
232 POKEU2,U2%
233 POKEU4,U4%
234 POKEU3,U3%-1
235 GOTO35
300 REM ** MENU **
301 :
302 PRINT"[147][144]":POKEUT,UU%:IFPEEK(50003)=0THENPOKE53281,15:POKE53280,0
303 :
305 PRINT" MENU"
310 PRINT" --------------------------------------"
315 PRINT" 1. BEGIN BLACKJACK"
320 PRINT" 2. INSTRUCTIONS"
335 PRINT" 3. QUIT"
340 PRINT" --------------------------------------"
345 PRINT" PRESS A NUMBER KEY (1-3) ";
350 UL=1:US$="123":GOSUB35:REM INPUT ROUTINE
352 US$=""
355 ONVAL(UR$)GOSUB1000,400,396
360 GOTO300
395 REM ** RE-ENABLE STOP KEY AND END **
396 CLR:END
400 REM ** STUDENT INSTRUCTIONS **
405 PRINT"[147]":POKEUT,UL%:IFPEEK(50003)=0THENPOKE53281,15:POKE53280,0
410 UP=0:UG$="[211]TUDENT [201]NST":GOSUB850
413 PRINT" [212]HIS GAME SIMULATES THE GAME OF
415 [153]" BLACKJACK.":[153]" (null)OU MUST GET UP TO 21 IN LESS"
420 [153]" THAN 5 CARDS. (null)OU CAN BET ON"
422 [153]" YOUR HAND. RIGHT$F YOU LOSE, YOUR BET"
425 [153]" IS DEDUCTED FROM YOUR TOTAL":[153]" EARNINGS."
426 [141]835:[141]850
427 [153]" (null)OU MAY DECIDE IF YOU WANT"
430 [153]" ANOTHER CARD EACH TIME. RIGHT$F YOU"
431 [153]" WANT TO DOUBLE YOUR BET WHEN YOU"
433 [153]" ARE IN THE MIDDLE OF A HAND, THE"
435 [153]" COMPUTER WILL GIVE YOU ANOTHER "
436 [153]" CARD AND DOUBLE YOUR BET."
437 [141]835:[141]850
438 [153]" (null)O DOUBLE BETWAIT: TYPE D <RETURN>"
440 [153]" LEFT$OUSE LIMIT ON EACH BETWAIT:":[153][163]26)"$25,000.00"
485 [141]835
490 [139]UZ[178]1[167][158]UP%:[137]217
499 [142]
835 [143] ** SPACE BAR PRESS **
840 [151]UO,0:[153][200](UD$,24);"PRESS SPACE BAR TO CONTINUEWAIT"
844 [161]UI$:[139]UI$[179][177]" "[167]844
846 [142]
850 [143] ** PAGE DESIGN ROUTINE **
852 UP[178]UP[170]1
853 [139][194](UT)[178]UL%[167]855
854 UT$[178]" BLACKJACK":UG$[178]"BLACKJACK":[137]857
855 UT$[178]" PEEK(null)ATNLEN(null)MID$ATNLEN(null)"
857 [153]"LOAD"[200](UT$[170]UP$,21);[201](UP$[170]UG$[170][196](UP),18)
860 [153]" --------------------------------------"
864 [139]UH[179][177]0[167]870
865 [153][200](UD$,24);[200](UP$,6);"TO EXIT GAME PRESS QWAIT ."
870 UH[178]0:[153]"":[142]
875 [143] ** PLEASE WAIT REMARK **
880 [153][200](UD$,24);" ONE MOMENT PLEASE... "
885 [142]
900 [143] ** SET UP VARIABLES **
901 UX$[178]"H":[134]UQ%(1000):UB[178]32768:U1[178]196:U2[178]197:U3[178]198:U4[178]216:UC[178]167:UU[178]1024
902 UT[178]59468:UU%[178]12:UL%[178]14:UP%[178]1146:UM[178]32768:UO[178]158:[151] 50003,0
903 [139][194](50003)[178]0[167]UB[178]1024:U1[178]209:U2[178]210:U3[178]211:U4[178]214:UC[178]204:UU[178]2048
904 [139][194](50003)[178]0[167]UT[178]53272:UU%[178]21:UL%[178]23:UP%[178]2139:UM[178]1024:UO[178]198
905 UD$[178]""
906 UP$[178]" "
908 [142]
910 [143] ** SET VARIABLES **
911 [134]C(52),P(10),D(10)
912 [134]S$(52),C$(52)
920 [141]900
980 [137]300:[143] MENU
1000 [139]UZ[178]1[167][158]UP%:[158]UP%:UZ[178]0:CS[178]0:[143] ** PROGRAM STARTS HERE **
1001 [153]"LOAD";:[140]:[139][194](50003)[178]0[167][151]53281,15:[151]53280,5
1070 S9$[178]"ATN(null)(null)(null)"
1080 C8$[178]"23456789TJQKA"
1090 C9$[178]" 2 3 4 5 6 7 8 91010101011"
1115 ER$[178]ER$[170]""
1120 DN$[178]""
1130 [143]
1170 [141]2260
1180 T[178]0
1190 J8[178]J
1200 [139]A9[179]4[167]1220
1210 [141]835:[141]2260
1220 [139]J[179]42[167]1240
1230 [141]835:[141]2260
1240 [153]DN$;ER$"PLACE YOUR BET. CMDCMDCMDCMDCMDCMDCMDCMD";
1245 CS[178]0
1250 US$[178]"012345678910Q":UL[178]5:[141]35:[139]UR$[178]"Q"[167]2160
1260 B1[178][197](UR$):K$[178]B$
1270 [139]B1[178]0[167]1240
1280 [139]B1[177]0[167]1310
1290 [141]835:[141]2260
1300 B1[178][171]B1
1310 [139]B1[177][178]1[167]1340
1320 [153]ER$"THE MINIMUM BET IS $1"
1330 [137]1190
1340 [139]B1[179][178]25000[167]1380
1350 [139]M1[178]1[167]2950
1360 [153]ER$:[153]ER$:[153]ER$"THE LIMIT PER BET IS $25,000."
1370 [137]1240
1380 P[178]0:D[178]0:P9[178]0:D9[178]0
1390 V[178]0
1400 H[178]0
1410 [141]850
1420 M1[178]1
1430 [141]2530
1440 [141]2650
1450 [141]3700
1460 J1[178]J
1470 M1[178]2
1480 [141]2530
1490 [141]2650
1500 [141]2860
1510 [139]P[178]21[167]1570
1520 [139]D[179]21[167]1650
1530 M1[178]1
1540 [141]2860
1550 [153]DN$""ER$"DEALER HAS A BLACKJACK"
1560 [137]2060
1570 M1[178]1
1580 [141]2860
1590 [139]D[179]21[167]1620
1600 [153]DN$""ER$"WE BOTH HAVE BLACKJACK"
1610 [137]2000
1620 [153]DN$""ER$"YOU HAVE A BLACKJACK"
1630 B1[178]1.5[172]B1
1640 [137]2020
1650 [139]P[179]22[167]1710
1660 [153]DN$""ER$"YOU HAVE BUSTED"
1665 [129]Q[178]1[164]400:[130]Q:CS[178]1
1670 M1[178]1
1680 [141]2860
1690 M1[178]2
1700 [137]2060
1710 [139]V[178]0[167]1730
1720 [137]1870
1730 [153]DN$;ER$"DO WANT ANOTHER CARD? CMD";
1760 US$[178]"YNDQ":UL[178]1:[141]35:A$[178]UR$
1765 [139]A$[178]"Q"[167]2160
1770 [139]A$[178]"Y"[167]1830
1780 [139]A$[178]"D"[167]1810
1800 [137]1870
1810 B1[178]2[172]B1
1820 V[178]1
1830 K$[178]B$
1840 M1[178]M1[170]1
1850 [141]2530
1860 [137]1650
1870 M1[178]1
1875 CS[178]1
1880 [141]2860
1890 M1[178]2
1900 [139]D[177]16[167]1950
1910 M1[178]M1[170]1
1920 [141]2650
1930 [141]2860
1940 [137]1900
1950 [139]D[179][178]21[167]1980
1960 [153]DN$""ER$"DEALER HAS BROKE--YOU WIN!":[141]3950
1970 [137]2030
1980 [139]D[179]P[167]2020
1990 [139]D[177]P[167]2060
2000 [153]DN$""ER$"YOU PUSHED THE DEALER "
2010 [137]2080
2020 [153]DN$""ER$"YOU WIN!":[141]3950
2030 T[178]T[170]B1
2040 [137]2080
2060 [153]DN$""ER$"YOU LOOSE!":[141]3900
2070 T[178]T[171]B1
2080 [139]T[177]0[167]2120
2090 [139]T[179]0[167]2140
2100 [153]" YOU ARE EVEN "
2110 [137]1190
2120 [153]" YOU ARE AHEAD $";T;
2130 [137]1190
2140 [153]" YOU ARE DOWN $";[171]T;
2150 [137]1190
2160 [141]850
2170 [139]T[178]0[167]2210
2180 [139]T[179]0[167]2230
2190 [153]DN$" YOU HAVE WON $";T;"CMD."
2200 [137]2250
2210 [153]DN$" YOU BROKE EVEN."
2220 [137]2250
2230 [153]DN$" YOU LOST $";[171]T;"CMD."
2250 [141]835:[142]
2260 [143] *** SHUFFLING ROUTINE
2270 [153]"LOAD"DN$;ER$" I'M SHUFFLING THE CARDS."
2280 [129]I[178]1[164]4
2290 [129]J[178]1[164]13
2300 W1[178]13[172](I[171]1)[170]J
2305 [153][163]18)"ON CMDCMDCMD";65[171]I[172]13[171]J
2310 S$(W1)[178][202](S9$,I,1)
2320 C$(W1)[178][202](C8$,J,1)
2330 C(W1)[178][197]([202](C9$,2[172]J[171]1,2))
2340 [130]J
2350 [130]I
2360 [129]I[178]1[164]52
2365 [153][163]18)"ON CMDCMDCMD";I;" "
2370 J[178]52[172][187](1)[170]1
2380 TT$[178]S$(I)
2390 S$(I)[178]S$(J)
2400 S$(J)[178]TT$
2410 TT$[178]C$(I)
2420 C$(I)[178]C$(J)
2430 C$(J)[178]TT$
2440 TT[178]C(I)
2450 C(I)[178]C(J)
2460 C(J)[178]TT
2470 [130]I
2480 A9[178]0
2490 J[178]0
2500 J1[178]2
2510 J8[178]0
2514 [141]850
2520 [142]
2530 J[178]J[170]1
2540 P(M1)[178]J
2550 [139]C(J)[179]11[167]2580
2560 P9[178]P9[170]1
2570 A9[178]A9[170]1
2580 P[178]P[170]C(J)
2590 [139]P[179]22[167]2630
2600 [139]P9[178]0[167]2630
2610 P[178]P[171]10
2620 P9[178]P9[171]1
2625 [153]""P"CMD "
2630 [153]DN$""
2640 [137]2890
2650 J[178]J[170]1
2660 D(M1)[178]J
2670 [139]C(J)[179]11[167]2700
2680 D9[178]D9[170]1
2690 A9[178]A9[170]1
2700 D[178]D[170]C(J)
2710 [139]D[179]22[167]2750
2720 [139]D9[178]0[167]2750
2730 D[178]D[171]10
2740 D9[178]D9[171]1
2750 [142]
2760 [129]I[178]1[164]52
2770 P(I)[178]0
2780 D(I)[178]0
2790 [130]I
2800 [142]
2810 [129]I[178]1[164]52
2820 [153]C$(I)[170]S$(I);
2830 [130]I
2840 [153]
2850 [142]
2860 P5[178]0
2870 [153]""
2880 [137]2900
2890 P5[178]1
2900 [129]L[178]1[164]8
2910 [139]M1[178]1[167]2950
2920 [129]I5[178]1[164]M1[171]1
2930 [153]"";
2940 [130]I5
2950 [139]P5[178]1[167]2980
2960 I[178]D(M1)
2970 [137]2990
2980 I[178]P(M1)
2990 [151]646,2
2995 [139]S$(I)[178]"ATN"[176]S$(I)[178]"(null)"[167][151]646,0:[141]3800
2996 [139]S$(I)[178]"(null)"[176]S$(I)[178]"(null)"[167][151]646,2:[141]3850
3000 R[178]C(I)
3010 [139]L[177]1[167]3030
3020 [153]QQ$;:[137]3660
3030 [139]L[177]2[167]3100
3040 [143]
3050 [139]C$(I)[178]"T"[167]3080
3060 [153]RR$;[201](C$(I),1);" ";RR$;
3070 [137]3660
3080 [153]RR$;"10";" ";RR$;
3090 [137]3660
3100 [139]L[177]3[167]3170
3110 [139]C(I)[179]11[167]3130
3120 [137]3590
3130 [139]C(I)[177]2[167]3150
3140 [137]3590
3150 [139]C(I)[177]3[167]3630
3160 [137]3610
3170 [139]L[177]4[167]3320
3180 [139]C(I)[179]11[167]3200
3190 [137]3610
3200 [139]C(I)[179]9[167]3220
3210 [137]3650
3220 [139]C(I)[177]3[167]3240
3230 [137]3610
3240 [139]C(I)[177]4[167]3260
3250 [137]3590
3260 [139]C(I)[177]5[167]3280
3270 [137]3610
3280 [139]C(I)[177]6[167]3300
3290 [137]3630
3300 [139]C(I)[177]7[167]3630
3310 [137]3610
3320 [139]L[177]5[167]3420
3330 [139]C(I)[179]11[167]3350
3340 [137]3590
3350 [139]C(I)[179]10[167]3370
3360 [137]3650
3370 [139]C(I)[179]6[167]3390
3380 [137]3630
3390 [139]C(I)[179]4[167]3410
3400 [137]3590
3410 [137]3610
3420 [139]L[177]6[167]3510
3430 [139]C(I)[179]11[167]3450
3440 [137]3590
3450 [139]C(I)[179]7[167]3470
3460 [137]3630
3470 [139]C(I)[178]4[167]3500
3480 [139]C(I)[178]5[167]3500
3490 [137]3590
3500 [137]3630
3510 [139]L[177]7[167]3580
3520 [153]RR$" ";
3530 [139]C$(I)[178]"T"[167]3560
3540 [153]" "[201](C$(I),1);RR$;
3550 [137]3660
3560 [153]" 10";RR$;
3570 [137]3660
3580 [153]SS$;:[137]3660
3590 [153]RR$" "RR$;
3600 [137]3660
3610 [153]RR$" ";S$(I);" ";RR$;
3620 [137]3660
3630 [153]RR$" ";S$(I);" ";S$(I);" ";RR$;
3640 [137]3660
3650 [153]RR$" ";S$(I);S$(I);S$(I);" ";RR$;
3660 [153]
3670 [130]L
3675 [153]""P"CMD "
3676 [139]CS[177]0[167][153]""D"CMD "
3680 [153]""
3690 [142]
3700 [153]""[170]QQ$
3710 [153]RR$[166]5)RR$
3720 [153]RR$[170]"STEP WAITFN "[170]RR$
3730 [153]RR$[170]" WAIT WAITSTEP"[170]RR$
3740 [153]RR$[170]" WAIT (null)WAIT"[170]RR$
3750 [153]RR$[170]"(null) WAIT "[170]RR$
3760 [153]RR$[166]5)RR$
3770 [153]SS$
3780 [142]
3800 QQ$[178]"PRINT#(null)LENLENLENLENLENRIGHT$STOP"
3810 RR$[178]"PRINT#PEEKSTOP"
3820 SS$[178]"PRINT#MID$ASCASCASCASCASC(null)STOP"
3830 [142]
3850 QQ$[178]"PRINT#(null)LENLENLENLENLENRIGHT$"
3860 RR$[178]"PRINT#PEEK"
3870 SS$[178]"PRINT#MID$ASCASCASCASCASC(null)"
3880 [142]
3900 [143] ** BUZZER
3905 [151]54296,15:[151]54277,45:[151]54278,165
3910 [151]54276,33:[151]54273,6:[151]54272,5
3915 [129]TT[178]1[164]200:[130]:[151]54276,32:[151]54273,0:[151]54273,0:[151]54272,0:[142]
3950 [143] ** BELL SOUND
3955 [151]54296,15:[151]54277,0:[151]54278,247
3960 [151]54276,17:[151]54273,40:[151]54272,0
3965 [129]TT[178]1[164]200:[130]:[151]54276,16:[151]54273,0:[151]54273,0:[151]54272,0:[142]